home *** CD-ROM | disk | FTP | other *** search
/ Exploring Aeronautics / NASA Exploring Aeronautics.iso / pc / source / fly.dxr / page5_2_motionPopUpObjectScript.ls < prev    next >
Encoding:
Text File  |  1998-06-02  |  3.2 KB  |  109 lines

  1. property ancestor, qtMovie, movieControlsLocation, movieControlSpriteList, movieLoc, offStage, motion, viewButtonList
  2. global gSoundManager, gButtonManager, gPathDelim
  3.  
  4. on new me
  5.   set the ancestor of me to new(script "popUpObjectScript")
  6.   set qtSprite to 47
  7.   set movieLoc to point(516, 384)
  8.   set qtMovie to new(script "quickTimeObjectScript", qtSprite, movieLoc)
  9.   set movieControlsLocation to point(517, 358)
  10.   set movieControlSpriteList to [20, 21, 22, 23, 24]
  11.   set offStage to point(-1000, -1000)
  12.   set viewButtonList to []
  13.   return me
  14. end
  15.  
  16. on mShowPopUp me, memberName
  17.   if the type of member memberName = #richText then
  18.     set the loc of sprite the popUpSprite of me to point(160, 120)
  19.   else
  20.     set the loc of sprite the popUpSprite of me to point(320, 240)
  21.   end if
  22.   set the member of sprite the popUpSprite of me to member memberName
  23.   updateStage()
  24.   set the popRect of me to the rect of sprite the popUpSprite of me
  25.   set the mouseDownScript to "mMouseDown(gPopUp)"
  26.   mGetHotSpotData(me, memberName)
  27.   mStopSound(gSoundManager)
  28.   mInitMovieArea(me)
  29.   mShowMovieArea(me)
  30. end
  31.  
  32. on mMouseDown me
  33.   if the optionDown then
  34.     mGetRect(me)
  35.   else
  36.     set clickLocation to the clickLoc
  37.     if inside(clickLocation, the popRect of me) then
  38.       do("mClosePopUp(gPopUp)")
  39.     else
  40.       if getPos([21, 22, 23, 24], the clickOn) then
  41.         pass()
  42.       else
  43.         beep()
  44.       end if
  45.     end if
  46.   end if
  47.   dontPassEvent()
  48. end
  49.  
  50. on mClosePopUp me
  51.   mHideMovieArea(me)
  52.   set the mouseDownScript to EMPTY
  53.   set the member of sprite the popUpSprite of me to member "dummyPixel"
  54.   updateStage()
  55.   set hotSpotList to []
  56.   set actionList to []
  57. end
  58.  
  59. on mInitMovieArea me
  60. end
  61.  
  62. on mShowMovieArea me
  63.   repeat with aSprite in movieControlSpriteList
  64.     puppetSprite(aSprite, 1)
  65.     set the loc of sprite aSprite to movieControlsLocation
  66.   end repeat
  67.   mInitMovie(qtMovie)
  68.   mSetDefaultMovie(me)
  69.   mSetMovieLoc(qtMovie, movieLoc)
  70.   mPlay(qtMovie, 1, 0)
  71.   add(viewButtonList, mAddButton(gButtonManager, 21, "FrontViewButton", "mPlayMovie(gPopUp, #front)"))
  72.   add(viewButtonList, mAddButton(gButtonManager, 22, "BackViewButton", "mPlayMovie(gPopUp, #back)"))
  73.   add(viewButtonList, mAddButton(gButtonManager, 23, "SideViewButton", "mPlayMovie(gPopUp, #side)"))
  74.   add(viewButtonList, mAddButton(gButtonManager, 24, "TopViewButton", "mPlayMovie(gPopUp, #top)"))
  75. end
  76.  
  77. on mHideMovieArea me
  78.   repeat with aSprite in movieControlSpriteList
  79.     set the loc of sprite aSprite to offStage
  80.   end repeat
  81.   mHideMovie(qtMovie)
  82.   mdispose(qtMovie)
  83.   repeat with aButton in viewButtonList
  84.     mDeleteButton(gButtonManager, aButton)
  85.   end repeat
  86.   set viewButtonList to []
  87. end
  88.  
  89. on mSetDefaultMovie me
  90.   set aMotionLabel to the name of member the member of sprite the popUpSprite of me
  91.   set motionID to (1 * (aMotionLabel contains "pitch")) + (2 * (aMotionLabel contains "roll")) + (3 * (aMotionLabel contains "yaw"))
  92.   case motionID of
  93.     1:
  94.       set motion to #p
  95.     2:
  96.       set motion to #r
  97.     3:
  98.       set motion to #y
  99.   end case
  100.   mPlayMovie(me, #front)
  101. end
  102.  
  103. on mPlayMovie me, aView
  104.   set motionString to string(motion)
  105.   set view to string(aView)
  106.   set movieName to "motion" & gPathDelim & motionString & view & ".mov"
  107.   mChangeMovie(qtMovie, movieName)
  108. end
  109.